package com.leyou.item.feign;

import com.leyou.common.constants.LyConstants;
import com.leyou.item.scheduled.AppTokenScheduler;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Autowired;

public class FeignInterceptor implements RequestInterceptor {
   @Autowired
   private AppTokenScheduler appTokenScheduler;

    @Override
    public void apply(RequestTemplate requestTemplate) {
        //header: 往请求头中存入数据
        requestTemplate.header(LyConstants.APP_TOKEN_HEADER,appTokenScheduler.getAppToken());
    }
}
